//
//  AccountSecurityViewController.m
//  cyydt
//
//  Created by 959 on 2018/12/24.
//  Copyright © 2018 959. All rights reserved.
//

#import "AccountSecurityViewController.h"
#import "ChangePhoneViewController.h"
#import "ChangePasswordViewController.h"
@interface AccountSecurityViewController () <UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *AccountTableView;

@end

@implementation AccountSecurityViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.AccountTableView.delegate = self;
    self.AccountTableView.dataSource = self;
    self.title = @"账号安全";
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    NSArray *cellArr =  @[@[@"修改密码", @"修改手机号"]];
    cell.textLabel.text = cellArr[indexPath.section][indexPath.row];
    cell.textLabel.textColor = RGBOF(0x333333);
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (![YLUserInfo isLogIn]) {
        LoginViewController *login = [[LoginViewController alloc] init];
        [[AppDelegate sharedAppDelegate] pushViewController:login];
        return;
    }
    if (indexPath.section == 0 && indexPath.row == 0) {
        ChangePasswordViewController *aboutVC =  [[ChangePasswordViewController alloc] init];
        aboutVC.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:aboutVC animated:YES];
        
    }else if(indexPath.section == 0 && indexPath.row == 1){
        
        ChangePhoneViewController *aboutVC =  [[ChangePhoneViewController alloc] init];
        aboutVC.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:aboutVC animated:YES];
    }
}
@end
